package com.auto.survey.util

import android.content.Context

object StatusBarHelper {

    const val STATUSBAR_TYPE_DEFAULT: Int = 0
    const val STATUSBAR_TYPE_MIUI: Int = 1
    const val STATUSBAR_TYPE_FLYME: Int = 2
    const val STATUSBAR_TYPE_ANDROID6: Int = 3 // Android 6.0
    const val STATUS_BAR_DEFAULT_HEIGHT_DP: Int = 25 // 大部分状态栏都是25dp
    // 在某些机子上存在不同的density值，所以增加两个虚拟值
    var sVirtualDensity: Float = -1f
    var sVirtualDensityDpi: Float = -1f
    const val sStatusbarHeight: Int = -1
    var mStatuBarType: Int = STATUSBAR_TYPE_DEFAULT
    val sTransparentValue: Int? = null



    

    /**
     * 获取状态栏高度
     *
     * @param context
     * @return
     */
    fun getStatusBarHeight(context: Context): Int {
        var statusBarHeight = -1

        if (statusBarHeight != -1) {
            return statusBarHeight
        }
        if (statusBarHeight <= 0) {
            val resId = context.resources.getIdentifier("status_bar_height", "dimen", "android")
            if (resId > 0) {
                statusBarHeight = context.resources.getDimensionPixelSize(resId)
            }
        }
        return statusBarHeight
    }
}